package com.it.tydic.estate.module.controller.khgl;

import com.it.tydic.estate.common.annotation.ControllerDesc;
import com.it.tydic.estate.common.aop.Result;
import com.it.tydic.estate.common.constants.LogConstants;
import com.it.tydic.estate.module.mapper.inner.OccupancyMapper;
import com.it.tydic.estate.module.model.inner.TbMoveOut;
import com.it.tydic.estate.module.service.OccupancyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @description:    综合数据控制器
 * @author: liuhui
 * @createDate: 2020/3/4
 * @version: 1.0
 */
@RestController
@RequestMapping("occupancy")
@Api(tags = "综合数据")
public class OccupancyController {
    @Autowired
    private OccupancyService occupancyService;  /*统计综合*/
    /**
     * 统计列表
     * @param map
     * @return
     */
    @PostMapping("/occupancyListByLike")
    @ApiOperation(value = "统计列表", notes = "用户统计列表")
    public Result OccupancyListByLike(@RequestBody Map<String,Object> map){
        return occupancyService.selectByLike(map);
    }

    /**
     * 入住历史
     * @param map
     * @return
     */
    @PostMapping("/checkInHistory")
    @ApiOperation(value = "入住历史", notes = "入住历史")
    public Result selectCheckInHistory(@RequestBody Map<String,Object> map){
        return occupancyService.selectCheckInHistory(map);
    }

    /**
     * 历史删除（批量）
     * @param list
     * @return
     */
    @PostMapping("/delEvents")
    @ControllerDesc(description = LogConstants.delete_data)
    @ApiOperation(value = "历史删除", notes = "历史删除")
    public Result delEvents(@RequestBody List<String> list){
        return occupancyService.deleteByIds(list);
    }
    /**
     * 客户概况 车位
     * @param map
     * @return
     */
    @PostMapping("/selectOccupancyCw")
    @ApiOperation(value = "车位", notes = "车位")
    public Result selectOccupancyCw(@RequestBody Map<String,Object> map){
        return occupancyService.selectOccupancyCw(map);
    }

    /**
     * 房间树
     */
    @GetMapping("/getRoomTree/{userCode}")
    @ApiOperation(value = "房间树", notes = "房间树")
    public Result getRoomTree(@PathVariable String userCode){
        return occupancyService.getRoomTree(userCode);
    }

}
